package ma.model.auxillary;

import java.util.ArrayList;
import java.util.Collection;
import java.util.NoSuchElementException;

public abstract class Tool {
	private String name;
	protected Collection<Parameter> parameters;
	
	public Tool(String name) {
		this.name = name;
		parameters = new ArrayList<Parameter>();
		addParameters();
	}
	
	public String getName() {
		return name;
	}
	
	public Collection<Parameter> getParameters() {
		return parameters;
	}
	
	public void addParameter(Parameter param) {
		parameters.add(param);
	}
	
	public void removeParameter(Parameter param) {
		if (parameters.contains(param)) {
			parameters.remove(param);
		} else {
			throw new NoSuchElementException(
					this + " does not hold " + param);
		}		
	}
	
	@Override
	public String toString() {
		return ("Tool: '" + name + "'");
	}
	
	/**
	 * To add parameters to this collection.
	 */
	protected abstract void addParameters();
}
